#include <iostream>
using namespace std;

int get_1st(int* sz, int len, int k) {
	int low = 0, high = len-1;
	while (low<=high) {
		int mid = (low + high)/2;
		if (sz[mid] == k) {
			if (mid==0 || sz[mid-1]!=k)
				return mid;
			else 
				high = mid - 1;
		}
		else if (sz[mid] < k) 
			low = mid + 1;
		else
			high = mid - 1;		
	}

	return -1;
}

//int main(){
//	int sz[] = {1,2,3,3,3,3,3,4,4,4,4,5};
//	int ret0 = get_1st(sz, 12, 1);
//	int ret1 = get_1st(sz, 12, 3);
//	int ret2 = get_1st(sz, 12, 4);
//	int ret3 = get_1st(sz, 12, 5);
//	int ret4 = get_1st(sz, 12, 7);
//	return 0;
//}